﻿using System;
using System.Runtime.InteropServices;
using System.Text;

namespace fakeunity.editor
{
    public static class nativefiledialog_native
    {
        public enum nfdresult
        {
            NFD_ERROR,       /* programmatic error */
            NFD_OKAY,        /* user pressed okay, or successful return */
            NFD_CANCEL       /* user pressed cancel */
        }

        const string nativelib = "fakeunity.native.editor";


        [DllImport(nativelib, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]

        //这个接口使用的Unicode格式字符串
        public extern static nfdresult NFD_OpenDialog(string filterList, string defaultPath, out string outPath);

        //以后再处理
        //c++ 库字符串问题比较混乱，同样是char* 有utf8的 有不知道什么东西的 有ascii的
        //wchar* 在 windows是 utf16*，在linux 默认是 utf32*
        //而c#这边string 都是utf16*
        //有些windows api 只能utf16*

        [DllImport(nativelib, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
        public extern static nfdresult NFD_PickFolder(string defaultPath,  out string outPath);
    }
}
